﻿namespace OleDbDAL.Sales
{
    using DBUtility;
    using IDal.Sales;
    using Model.Sales;
    using Model.Systems;
    using System;
    using System.Data;
    using System.Text;
    using WinFormSession;

    public class OrdersApp : IOrders
    {
        private string dbname = "Systems";

        public void Add(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("insert into T_Orders(");
            builder.Append("OrderNum,GuestId,GuestName,ChainNum,UserId,CreateTime,ToMeetMoney,PaidMoney,CostMoney,SentProMoney,LogisticsId,LogisticsName,LogisticsNum,ShipmentsType,ClearingType,DistrType,Addresses,LinkMan,LinkTel,ZipCode,IsReview,ReviewMan,ReviewTime,IsUseReturn,ReturnTime,ReturnMoney,Reason,IsReturn,NotReason,FollowUpDeal,IsCheck,CheckMan,CheckTime,SaleVtag,IsOut,IsRequestRetrun,OpenType,ProcurementId,IsInvoicing,InvoicingNum,IsBlackOut,Remark");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.OrderNum + "',");
            builder.Append("" + model.GuestId + ",");
            builder.Append("'" + model.GuestName + "',");
            builder.Append("" + model.ChainNum + ",");
            builder.Append("" + model.UserId + ",");
            builder.Append("'" + model.CreateTime + "',");
            builder.Append("" + model.ToMeetMoney + ",");
            builder.Append("" + model.PaidMoney + ",");
            builder.Append("" + model.CostMoney + ",");
            builder.Append("" + model.SentProMoney + ",");
            builder.Append("" + model.LogisticsId + ",");
            builder.Append("'" + model.LogisticsName + "',");
            builder.Append("'" + model.LogisticsNum + "',");
            builder.Append("" + model.ShipmentsType + ",");
            builder.Append("" + model.ClearingType + ",");
            builder.Append("" + model.DistrType + ",");
            builder.Append("'" + model.Addresses + "',");
            builder.Append("'" + model.LinkMan + "',");
            builder.Append("'" + model.LinkTel + "',");
            builder.Append("'" + model.ZipCode + "',");
            builder.Append("" + model.IsReview + ",");
            builder.Append("" + model.ReviewMan + ",");
            builder.Append("'" + model.ReviewTime + "',");
            builder.Append("" + model.IsUseReturn + ",");
            builder.Append("'" + model.ReturnTime + "',");
            builder.Append("" + model.ReturnMoney + ",");
            builder.Append("'" + model.Reason + "',");
            builder.Append("" + model.IsReturn + ",");
            builder.Append("'" + model.NotReason + "',");
            builder.Append("" + model.FollowUpDeal + ",");
            builder.Append("" + model.IsCheck + ",");
            builder.Append("" + model.CheckMan + ",");
            builder.Append("'" + model.CheckTime + "',");
            builder.Append("" + model.SaleVtag + ",");
            builder.Append("" + model.IsOut + ",");
            builder.Append("" + model.IsRequestRetrun + ",");
            builder.Append("" + model.OpenType + ",");
            builder.Append("" + model.ProcurementId + ",");
            builder.Append("" + model.IsInvoicing + ",");
            builder.Append("'" + model.InvoicingNum + "',");
            builder.Append("" + model.IsBlackOut + ",");
            builder.Append("'" + model.Remark + "'");
            builder.Append(")");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public bool Check(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("IsCheck=" + model.IsCheck + ",");
            builder.Append("CheckMan=" + model.CheckMan + ",");
            builder.Append("CheckTime='" + model.CheckTime + "'");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
            return true;
        }

        public void Delete(int OrdersId)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("delete from T_Orders ");
            builder.Append(" where OrdersId=" + OrdersId);
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public void FuCheck(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("IsReview=" + model.IsReview + ",");
            builder.Append("ReviewMan=" + model.ReviewMan + ",");
            builder.Append("ReviewTime='" + model.ReviewTime + "',");
            builder.Append("IsOut=" + model.IsOut + "");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public DataTable GetList(string strWhere)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select * from T_Orders ");
            if (strWhere.Trim() != "")
            {
                builder.Append(" where " + strWhere);
            }
            builder.Append(" order by OrdersId ");
            return DbHelperOledb.Query(this.dbname, builder.ToString());
        }

        public int GetMaxId(string swhere)
        {
            return DbHelperOledb.GetMaxID(this.dbname, "OrdersId", "T_Orders", swhere);
        }

        public OrdersEnt GetModel(int OrdersId)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select OrdersId,OrderNum,GuestId,GuestName,ChainNum,UserId,CreateTime,ToMeetMoney,PaidMoney,CostMoney,SentProMoney,LogisticsId,LogisticsName,LogisticsNum,ShipmentsType,ClearingType,DistrType,Addresses,LinkMan,LinkTel,ZipCode,IsReview,ReviewMan,ReviewTime,IsUseReturn,ReturnTime,ReturnMoney,Reason,IsReturn,NotReason,FollowUpDeal,IsCheck,CheckMan,CheckTime,SaleVtag,IsOut,IsRequestRetrun,OpenType,ProcurementId,IsInvoicing,InvoicingNum,IsBlackOut,BlackManId,BlackManName,BlackTime,Remark from T_Orders ");
            builder.Append(" where OrdersId=" + OrdersId);
            OrdersEnt ent = new OrdersEnt();
            DataTable table = DbHelperOledb.Query(this.dbname, builder.ToString());
            ent.OrdersId = OrdersId;
            if (table.Rows.Count > 0)
            {
                ent.OrderNum = table.Rows[0]["OrderNum"].ToString();
                if (table.Rows[0]["GuestId"].ToString() != "")
                {
                    ent.GuestId = int.Parse(table.Rows[0]["GuestId"].ToString());
                }
                ent.GuestName = table.Rows[0]["GuestName"].ToString();
                if (table.Rows[0]["ChainNum"].ToString() != "")
                {
                    ent.ChainNum = int.Parse(table.Rows[0]["ChainNum"].ToString());
                }
                if (table.Rows[0]["UserId"].ToString() != "")
                {
                    ent.UserId = int.Parse(table.Rows[0]["UserId"].ToString());
                }
                if (table.Rows[0]["CreateTime"].ToString() != "")
                {
                    ent.CreateTime = DateTime.Parse(table.Rows[0]["CreateTime"].ToString());
                }
                if (table.Rows[0]["ToMeetMoney"].ToString() != "")
                {
                    ent.ToMeetMoney = decimal.Parse(table.Rows[0]["ToMeetMoney"].ToString());
                }
                if (table.Rows[0]["PaidMoney"].ToString() != "")
                {
                    ent.PaidMoney = decimal.Parse(table.Rows[0]["PaidMoney"].ToString());
                }
                if (table.Rows[0]["CostMoney"].ToString() != "")
                {
                    ent.CostMoney = decimal.Parse(table.Rows[0]["CostMoney"].ToString());
                }
                if (table.Rows[0]["SentProMoney"].ToString() != "")
                {
                    ent.SentProMoney = decimal.Parse(table.Rows[0]["SentProMoney"].ToString());
                }
                if (table.Rows[0]["LogisticsId"].ToString() != "")
                {
                    ent.LogisticsId = int.Parse(table.Rows[0]["LogisticsId"].ToString());
                }
                ent.LogisticsName = table.Rows[0]["LogisticsName"].ToString();
                ent.LogisticsNum = table.Rows[0]["LogisticsNum"].ToString();
                if (table.Rows[0]["ShipmentsType"].ToString() != "")
                {
                    ent.ShipmentsType = int.Parse(table.Rows[0]["ShipmentsType"].ToString());
                }
                if (table.Rows[0]["ClearingType"].ToString() != "")
                {
                    ent.ClearingType = int.Parse(table.Rows[0]["ClearingType"].ToString());
                }
                if (table.Rows[0]["DistrType"].ToString() != "")
                {
                    ent.DistrType = int.Parse(table.Rows[0]["DistrType"].ToString());
                }
                ent.Addresses = table.Rows[0]["Addresses"].ToString();
                ent.LinkMan = table.Rows[0]["LinkMan"].ToString();
                ent.LinkTel = table.Rows[0]["LinkTel"].ToString();
                ent.ZipCode = table.Rows[0]["ZipCode"].ToString();
                if (table.Rows[0]["IsReview"].ToString() != "")
                {
                    ent.IsReview = int.Parse(table.Rows[0]["IsReview"].ToString());
                }
                if (table.Rows[0]["ReviewMan"].ToString() != "")
                {
                    ent.ReviewMan = int.Parse(table.Rows[0]["ReviewMan"].ToString());
                }
                if (table.Rows[0]["ReviewTime"].ToString() != "")
                {
                    ent.ReviewTime = DateTime.Parse(table.Rows[0]["ReviewTime"].ToString());
                }
                if (table.Rows[0]["IsUseReturn"].ToString() != "")
                {
                    ent.IsUseReturn = int.Parse(table.Rows[0]["IsUseReturn"].ToString());
                }
                if (table.Rows[0]["ReturnTime"].ToString() != "")
                {
                    ent.ReturnTime = DateTime.Parse(table.Rows[0]["ReturnTime"].ToString());
                }
                if (table.Rows[0]["ReturnMoney"].ToString() != "")
                {
                    ent.ReturnMoney = decimal.Parse(table.Rows[0]["ReturnMoney"].ToString());
                }
                ent.Reason = table.Rows[0]["Reason"].ToString();
                if (table.Rows[0]["IsReturn"].ToString() != "")
                {
                    ent.IsReturn = int.Parse(table.Rows[0]["IsReturn"].ToString());
                }
                ent.NotReason = table.Rows[0]["NotReason"].ToString();
                if (table.Rows[0]["FollowUpDeal"].ToString() != "")
                {
                    ent.FollowUpDeal = int.Parse(table.Rows[0]["FollowUpDeal"].ToString());
                }
                if (table.Rows[0]["IsCheck"].ToString() != "")
                {
                    ent.IsCheck = int.Parse(table.Rows[0]["IsCheck"].ToString());
                }
                if (table.Rows[0]["CheckMan"].ToString() != "")
                {
                    ent.CheckMan = int.Parse(table.Rows[0]["CheckMan"].ToString());
                }
                if (table.Rows[0]["CheckTime"].ToString() != "")
                {
                    ent.CheckTime = DateTime.Parse(table.Rows[0]["CheckTime"].ToString());
                }
                if (table.Rows[0]["SaleVtag"].ToString() != "")
                {
                    ent.SaleVtag = int.Parse(table.Rows[0]["SaleVtag"].ToString());
                }
                if (table.Rows[0]["IsOut"].ToString() != "")
                {
                    ent.IsOut = int.Parse(table.Rows[0]["IsOut"].ToString());
                }
                if (table.Rows[0]["IsRequestRetrun"].ToString() != "")
                {
                    ent.IsRequestRetrun = int.Parse(table.Rows[0]["IsRequestRetrun"].ToString());
                }
                if (table.Rows[0]["OpenType"].ToString() != "")
                {
                    ent.OpenType = int.Parse(table.Rows[0]["OpenType"].ToString());
                }
                if (table.Rows[0]["ProcurementId"].ToString() != "")
                {
                    ent.ProcurementId = int.Parse(table.Rows[0]["ProcurementId"].ToString());
                }
                if (table.Rows[0]["IsInvoicing"].ToString() != "")
                {
                    ent.IsInvoicing = int.Parse(table.Rows[0]["IsInvoicing"].ToString());
                }
                ent.InvoicingNum = table.Rows[0]["InvoicingNum"].ToString();
                if (table.Rows[0]["IsBlackOut"].ToString() != "")
                {
                    ent.IsBlackOut = int.Parse(table.Rows[0]["IsBlackOut"].ToString());
                }
                if (table.Rows[0]["BlackManId"].ToString() != "")
                {
                    ent.BlackManId = int.Parse(table.Rows[0]["BlackManId"].ToString());
                }
                ent.BlackManName = table.Rows[0]["BlackManName"].ToString();
                if (table.Rows[0]["BlackTime"].ToString() != "")
                {
                    ent.BlackTime = DateTime.Parse(table.Rows[0]["BlackTime"].ToString());
                }
                ent.Remark = table.Rows[0]["Remark"].ToString();
                return ent;
            }
            return null;
        }

        public DataTable GetPageList(int PageSize, int PageIndex, string strWhere)
        {
            string orderString = "";
            int pageCount = 0;
            int recordCount = 0;
            StringBuilder builder = new StringBuilder();
            builder.Append("select * from T_Orders ");
            return DbHelperOledb.ExecutePager(this.dbname, PageIndex, PageSize, "", builder.ToString(), strWhere, orderString, out pageCount, out recordCount, "OrdersId");
        }

        public void IsRequestReturn(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("IsRequestRetrun=" + model.IsRequestRetrun + "");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public bool ReturnOrder(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("IsRequestRetrun=" + model.IsRequestRetrun + ",");
            builder.Append("IsUseReturn=" + model.IsUseReturn + ",");
            builder.Append("ReturnTime='" + model.ReturnTime + "',");
            builder.Append("ReturnMoney=" + model.ReturnMoney + ",");
            builder.Append("Reason='" + model.Reason + "',");
            builder.Append("IsReturn=" + model.IsReturn + ",");
            builder.Append("NotReason='" + model.NotReason + "',");
            builder.Append("FollowUpDeal=" + model.FollowUpDeal + "");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
            return true;
        }

        public DataTable ReturnTopDataTable(string strWhere, int top)
        {
            DataTable table;
            try
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("select top " + top.ToString() + " * from T_Orders ");
                if (strWhere.Trim() != "")
                {
                    builder.Append(" where " + strWhere);
                }
                builder.Append(" order by CreateTime desc");
                table = DbHelperOledb.Query(this.dbname, builder.ToString());
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return table;
        }

        public DataTable SearchData(string strWhere)
        {
            StringBuilder builder = new StringBuilder();
            UserEnt ent = (UserEnt) WinformSession.GetSession()["user"];
            builder.Append("select OrdersId,OrderNum,");
            builder.Append("(Select GuestName from T_Guest where T_Guest.GuestId=T_Orders.GuestId) as GuestName,");
            builder.Append("(select UserName from T_User where T_User.UserId=T_Orders.UserId) as UserName,");
            builder.Append("CreateTime,ToMeetMoney,PaidMoney");
            builder.Append(" from T_Orders ");
            if (strWhere != "")
            {
                builder.Append(" where ");
                builder.Append(strWhere);
                builder.Append(" and T_Orders.IsBlackOut=0 and ChainNum=" + ent.ChainNum);
            }
            else
            {
                builder.Append(" where  T_Orders.IsBlackOut=0 and ChainNum=" + ent.ChainNum);
            }
            builder.Append(" order by OrdersId desc");
            return DbHelperOledb.Query(this.dbname, builder.ToString());
        }

        public DataTable SelectGuestDetials(string swhere)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select T_Orders.OrdersId,T_Orders.OrderNum,T_Orders.UserId,T_Orders.CreateTime,");
            builder.Append("T_OrdersComm.LotNum,T_OrdersComm.CommName,T_OrdersComm.Amount,T_OrdersComm.AmoutMoney,T_OrdersComm.Cost,");
            builder.Append("(select ParName from T_Parameter where T_Parameter.ParId=T_OrdersComm.AmoutUnit) as AmoutUnit");
            builder.Append(" from T_Orders,T_OrdersComm");
            builder.Append(" where T_Orders.OrdersId=T_OrdersComm.OrdersId and T_Orders.IsBlackOut=0 and T_OrdersComm.IsGiveGuestPresent=0");
            builder.Append(swhere);
            builder.Append(" order by T_Orders.OrdersId desc");
            return DbHelperOledb.Query(this.dbname, builder.ToString());
        }

        public DataTable SelectGuestDetialsTwo(string swhere)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select T_Orders.OrdersId,T_Orders.OrderNum,T_Orders.CreateTime,");
            builder.Append("(select UserName from T_User where T_Orders.UserId=T_User.UserId) as UserId,");
            builder.Append("T_OrdersComm.LotNum,T_OrdersComm.CommName,T_OrdersComm.Amount,T_OrdersComm.AmoutMoney,T_OrdersComm.Cost,");
            builder.Append("(select ParName from T_Parameter where T_Parameter.ParId=T_OrdersComm.AmoutUnit) as AmoutUnit");
            builder.Append(" from T_Orders,T_OrdersComm");
            builder.Append(" where T_Orders.OrdersId=T_OrdersComm.OrdersId and T_Orders.IsBlackOut=0 and T_OrdersComm.IsGiveGuestPresent=0");
            builder.Append(swhere);
            builder.Append(" order by T_Orders.OrdersId desc");
            return DbHelperOledb.Query(this.dbname, builder.ToString());
        }

        public DataTable SelectSendsPresent(string swhere)
        {
            StringBuilder builder = new StringBuilder();
            UserEnt ent = (UserEnt) WinformSession.GetSession()["user"];
            builder.Append("select T_Orders.OrdersId,T_Orders.OrderNum,T_Orders.CreateTime,");
            builder.Append("T_OrdersComm.LotNum,T_OrdersComm.CommName,T_OrdersComm.Amount,T_OrdersComm.AmoutMoney,T_OrdersComm.Cost,");
            builder.Append("(select ParName from T_Parameter where T_Parameter.ParId=T_OrdersComm.AmoutUnit) as AmoutUnit,");
            builder.Append("(select UserName from T_User where T_User.UserId=T_Orders.UserId) as UserId,");
            builder.Append("(select GuestName from T_Guest where T_Guest.GuestId=T_Orders.GuestId) as GuestId");
            builder.Append(" from T_Orders,T_OrdersComm");
            builder.Append(" where T_Orders.OrdersId=T_OrdersComm.OrdersId and T_Orders.IsBlackOut=0 and T_OrdersComm.IsGiveGuestPresent=1 and T_Orders.ChainNum=" + ent.ChainNum);
            builder.Append(swhere);
            builder.Append(" order by T_Orders.OrdersId desc");
            return DbHelperOledb.Query(this.dbname, builder.ToString());
        }

        public DataTable SelectSendsPresent(int PageSize, int PageIndex, string strWhere)
        {
            int pageCount = 0;
            int recordCount = 0;
            StringBuilder builder = new StringBuilder();
            UserEnt ent = (UserEnt) WinformSession.GetSession()["user"];
            builder.Append("select T_Orders.OrdersId,T_Orders.OrderNum,T_Orders.CreateTime,");
            builder.Append("T_OrdersComm.LotNum,T_OrdersComm.CommName,T_OrdersComm.Amount,T_OrdersComm.AmoutMoney,T_OrdersComm.Cost,");
            builder.Append("(select ParName from T_Parameter where T_Parameter.ParId=T_OrdersComm.AmoutUnit) as AmoutUnit,");
            builder.Append("(select UserName from T_User where T_User.UserId=T_Orders.UserId) as UserId,");
            builder.Append("(select GuestName from T_Guest where T_Guest.GuestId=T_Orders.GuestId) as GuestId");
            builder.Append(" from T_Orders,T_OrdersComm");
            builder.Append(" where T_Orders.OrdersId=T_OrdersComm.OrdersId and T_Orders.IsBlackOut=0 and T_OrdersComm.IsGiveGuestPresent=1 and T_Orders.ChainNum=" + ent.ChainNum);
            builder.Append(strWhere);
            return DbHelperOledb.ExecutePager(this.dbname, PageIndex, PageSize, "", builder.ToString(), "", "$%", out pageCount, out recordCount, "OrdersId");
        }

        public void Update(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("OrderNum='" + model.OrderNum + "',");
            builder.Append("GuestId=" + model.GuestId + ",");
            builder.Append("GuestName='" + model.GuestName + "',");
            builder.Append("ChainNum=" + model.ChainNum + ",");
            builder.Append("UserId=" + model.UserId + ",");
            builder.Append("CreateTime='" + model.CreateTime + "',");
            builder.Append("ToMeetMoney=" + model.ToMeetMoney + ",");
            builder.Append("PaidMoney=" + model.PaidMoney + ",");
            builder.Append("CostMoney=" + model.CostMoney + ",");
            builder.Append("SentProMoney=" + model.SentProMoney + ",");
            builder.Append("LogisticsId=" + model.LogisticsId + ",");
            builder.Append("LogisticsName='" + model.LogisticsName + "',");
            builder.Append("LogisticsNum='" + model.LogisticsNum + "',");
            builder.Append("ShipmentsType=" + model.ShipmentsType + ",");
            builder.Append("ClearingType=" + model.ClearingType + ",");
            builder.Append("DistrType=" + model.DistrType + ",");
            builder.Append("Addresses='" + model.Addresses + "',");
            builder.Append("LinkMan='" + model.LinkMan + "',");
            builder.Append("LinkTel='" + model.LinkTel + "',");
            builder.Append("ZipCode='" + model.ZipCode + "',");
            builder.Append("IsReview=" + model.IsReview + ",");
            builder.Append("ReviewMan=" + model.ReviewMan + ",");
            builder.Append("ReviewTime='" + model.ReviewTime + "',");
            builder.Append("IsUseReturn=" + model.IsUseReturn + ",");
            builder.Append("ReturnTime='" + model.ReturnTime + "',");
            builder.Append("ReturnMoney=" + model.ReturnMoney + ",");
            builder.Append("Reason='" + model.Reason + "',");
            builder.Append("IsReturn=" + model.IsReturn + ",");
            builder.Append("NotReason='" + model.NotReason + "',");
            builder.Append("FollowUpDeal=" + model.FollowUpDeal + ",");
            builder.Append("IsCheck=" + model.IsCheck + ",");
            builder.Append("CheckMan=" + model.CheckMan + ",");
            builder.Append("CheckTime='" + model.CheckTime + "',");
            builder.Append("SaleVtag=" + model.SaleVtag + ",");
            builder.Append("IsOut=" + model.IsOut + ",");
            builder.Append("IsRequestRetrun=" + model.IsRequestRetrun + ",");
            builder.Append("OpenType=" + model.OpenType + ",");
            builder.Append("ProcurementId=" + model.ProcurementId + ",");
            builder.Append("IsInvoicing=" + model.IsInvoicing + ",");
            builder.Append("InvoicingNum='" + model.InvoicingNum + "',");
            builder.Append("IsBlackOut=" + model.IsBlackOut + ",");
            builder.Append("Remark='" + model.Remark + "'");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public void UpdateCostMoneyAndSendMoney(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("CostMoney=" + model.CostMoney + ",");
            builder.Append("SentProMoney=" + model.SentProMoney + "");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public void UpdateSaleVag(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("SaleVtag=" + model.SaleVtag + "");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
        }

        public bool UpdateZuoFei(OrdersEnt model)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("update T_Orders set ");
            builder.Append("IsBlackOut=" + model.IsBlackOut + ",");
            builder.Append("BlackManId=" + model.BlackManId + ",");
            builder.Append("BlackManName='" + model.BlackManName + "',");
            builder.Append("BlackTime='" + model.BlackTime + "'");
            builder.Append(" where OrdersId=" + model.OrdersId + "");
            DbHelperOledb.ExecuteSql(this.dbname, builder.ToString());
            return true;
        }
    }
}

